package com.book.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/manage")
public class managePageController {

    @RequestMapping("/adminManage")
    public String toadminManage(HttpSession session) {
        if (session.getAttribute("admin")==null) {
            return "adminLogin.html";
        } else {
            return "adminManage.html";
        }
    }


    @RequestMapping("/bookManage")
    public String tobookManage( HttpSession session) {
        if (session.getAttribute("admin") == null) {
            return "adminLogin.html";
        } else {
            return "bookManage.html";
        }
    }

    @RequestMapping("/bookTypeManage")
    public String tobookTypeManage(HttpSession session) {
        if (session.getAttribute("admin") == null) {
            return "adminLogin.html";
        } else {
            return "bookTypeManage.html";
        }
    }


    @RequestMapping("/readerManage")
    public String toreaderManage(HttpSession session) {
        if (session.getAttribute("admin") == null) {
            return "adminLogin.html";
        } else {
            return "readerManage.html";
        }

    }


    @RequestMapping("/borrowSearch")
    public String toborrowSearch(HttpSession session) {
        if (session.getAttribute("admin") == null) {
            return "adminLogin.html";
        } else {
            return "borrowSearch.html";
        }

    }

    @RequestMapping("/home")
    public String tohome(HttpSession session) {
        if (session.getAttribute("admin") == null) {
            return "adminLogin.html";
        } else {
            return "admin.html";
        }

    }
}
